<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMachineConfigsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('machine_configs', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('machine_id')->default(0)->comment('设备ID');
            $table->string('title')->default('')->comment('标题');
            $table->string('key')->default('')->comment('参数key');
            $table->tinyInteger('state')->default(0)->comment('状态:0关闭1开启');
            $table->string('value')->default('')->comment('参数值');
            $table->string('start')->default('')->comment('开始时间');
            $table->string('end')->default('')->comment('结束时间');
            $table->timestamps();
        });
        Schema::table('machines', function(Blueprint $table){
            $table->dropColumn('config');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('machine_configs');
    }
}
